import subprocess

from py.handler.msg_handler_abc import MsgHandlerAbc
from py.uitls import WinUtil


class MsgHandlerButton(MsgHandlerAbc):
    def handle(self, title, content):
        unrecognized = WinUtil.button_event(content)
        if unrecognized == '':
            title = '成功执行快捷键！'
            msg = '<p>已成功执行以下快捷键：</p><p>%s</p>' % content
        else:
            title = '存在无法识别的快捷键！'
            msg = '<p>您发送的快捷键为“%s”</p><p>其中快捷键“%s”无法识别</p>' % (content, unrecognized)
        return title, msg, None
